package org.dwell.urlfilter.demo.service;

import org.dwell.urlfilter.demo.domain.CoreUser;
import org.dwell.urlfilter.demo.test.CoreUserDB;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by Jange on 2016/4/6.
 */
@Service
public class CoreUserService {

    public CoreUser findByUsername(String username) {
        List<CoreUser> users = CoreUserDB.getAll();
        for (CoreUser user : users) {
            if(user.getUsername().equalsIgnoreCase(username)) {
                return user;
            }
        }
        return null;
    }

}
